home *** CD-ROM | disk | FTP | other *** search
/ Magic Disk 64 / Magic_Disk_64_95-09_1995_-_de_Side_B.d64 / sprite-source #5 < prev    next >
Text File  |  2023-02-26  |  5KB  |  302 lines

  1.  
  2.  
  3. ;---------------------------------------
  4. ;
  5. ;          - S P R I T E S -
  6. ;
  7. ;           Source-File #5:
  8. ;
  9. ;        'Kollissions-Abfrage'
  10. ;
  11. ;          by Hannes Sommer
  12. ;
  13. ;       (c) 1993 CP-Verlag Gmbh
  14. ;
  15. ;---------------------------------------
  16.  
  17.  
  18. v        = 53248
  19.  
  20.          *= $0810
  21.          jmp $0880
  22.  
  23.          *= $0840
  24.  
  25.          .byte 0,255,0,3,255,192
  26.          .byte 15,255,240,31,255,248
  27.          .byte 63,255,252,63,255,252
  28.          .byte 127,189,254,127,189,254
  29.          .byte 255,189,255,255,255,255
  30.          .byte 255,255,255,247,255,239
  31.          .byte 251,255,223,124,126,62
  32.          .byte 127,129,254,63,255,252
  33.          .byte 63,255,252,31,255,248
  34.          .byte 15,255,240,3,255,192
  35.          .byte 0,255,0,0
  36.  
  37.  
  38.          lda #255   ;Initialisierung!
  39.          sta v+21
  40.  
  41.          sei
  42.          lda #<irq
  43.          sta $0314
  44.          lda #>irq
  45.          sta $0315
  46.          lda #129
  47.          sta $d01a
  48.          lda #27
  49.          sta $d011
  50.          lda #250
  51.          sta $d012
  52.          cli
  53.  
  54.          ldx #0
  55. i1       lda text,x
  56.          beq i2
  57.          jsr $ffd2
  58.          inx
  59.          bne i1
  60. i2
  61.  
  62.  
  63. end      rts
  64.  
  65.  
  66. text     .byte 13,18
  67.          .text "joystick-abfrage im "
  68.          .text "irq aktiviert."
  69.          .byte 146,13,13,0
  70.  
  71.  
  72.  
  73. ;---------------------------------------
  74. ;               I R Q
  75. ;---------------------------------------
  76.  
  77.  
  78. irq      lda $d019
  79.          sta $d019
  80.          bmi t1
  81.          lda $dc0d
  82.          cli
  83.          jmp $ea31
  84.  
  85. t1
  86.          lda $dc00  ;Joystick!
  87.          sta joyst
  88.          and #1     ;up ?
  89.          bne t5
  90.          lda ypoint
  91.          cmp #1
  92.          beq t10
  93.          dec ypoint
  94.          jmp t10
  95. t5       lda joyst
  96.          and #2     ;down ?
  97.          bne t8
  98.          lda ypoint
  99.          cmp #31
  100.          beq t10
  101.          inc ypoint
  102.          bne t10
  103. t8       lda #0     ;Y-Bremse...
  104.          inc t8+1
  105.          and #1
  106.          bne t10
  107.          lda ypoint
  108.          cmp #16
  109.          beq t10
  110.          bcc t9
  111.          dec ypoint
  112.          bne t10
  113. t9       inc ypoint
  114. t10
  115.          lda joyst
  116.          and #4     ;left ?
  117.          bne t15
  118.          lda xpoint
  119.          cmp #1
  120.          beq t20
  121.          dec xpoint
  122.          jmp t20
  123. t15      lda joyst
  124.          and #8     ;right ?
  125.          bne t18
  126.          lda xpoint
  127.          cmp #31
  128.          beq t20
  129.          inc xpoint
  130.          bne t20
  131. t18      lda #0     ;X-Bremse...
  132.          inc t18+1
  133.          and #1
  134.          bne t20
  135.          lda xpoint
  136.          cmp #16
  137.          beq t20
  138.          bcc t19
  139.          dec xpoint
  140.          bne t20
  141. t19      inc xpoint
  142. t20
  143.  
  144.  
  145.          lda ypoint ;Y-moving !
  146.          clc
  147.          adc #1
  148.          lsr a
  149.          lsr a
  150.          tax
  151.          lda y
  152.          clc
  153.          adc speedtab,x
  154.          sta y
  155.          cmp #50
  156.          bcs t21
  157.          lda #50
  158.          sta y
  159.          lda ypoint
  160.          eor #31
  161.          clc
  162.          adc #2
  163.          sta ypoint
  164.          jmp t25
  165. t21      cmp #230
  166.          bcc t25
  167.          lda #230
  168.          sta y
  169.          lda ypoint
  170.          and #254
  171.          eor #31
  172.          sta ypoint
  173. t25
  174.  
  175.          lda xpoint ;X-moving !
  176.          clc
  177.          adc #1
  178.          lsr a
  179.          lsr a
  180.          tax
  181.          cpx #4
  182.          bcs t35
  183.          lda x
  184.          clc
  185.          adc speedtab,x
  186.          sta x
  187.          bcs t31
  188.          lda #0
  189.          sta xhi
  190. t31
  191.          lda xhi
  192.          bne t40
  193.          lda x
  194.          cmp #24
  195.          bcs t40
  196.          lda #24
  197.          sta x
  198.          lda xpoint
  199.          eor #31
  200.          clc
  201.          adc #2
  202.          sta xpoint
  203.          jmp t40
  204.  
  205. t35      lda x
  206.          clc
  207.          adc speedtab,x
  208.          sta x
  209.          bcc t36
  210.          lda #1
  211.          sta xhi
  212. t36      lda xhi
  213.          beq t40
  214.          lda x
  215.          cmp #63
  216.          bcc t40
  217.          lda #64
  218.          sta x
  219.          lda xpoint
  220.          and #254
  221.          eor #31
  222.          sta xpoint
  223. t40
  224.          lda #0
  225.          sta v+16
  226.          ldx #7
  227. t41      lda y,x
  228.          ldy mal2,x
  229.          sta v+1,y
  230.          lda col,x
  231.          sta v+39,x
  232.          lda #33
  233.          sta 2040,x
  234.          lda x,x
  235.          sta v,y
  236.          lsr a
  237.          ldy xhi,x
  238.          beq t42
  239.          pha
  240.          lda v+16
  241.          ora oder,x
  242.          sta v+16
  243.          pla
  244.          ora #128
  245. t42      sta xhalf,x
  246.          dex
  247.          bpl t41
  248.  
  249.          lda #0
  250.          sta t60+1
  251.          sta $d021
  252.  
  253.          lda v+30
  254.          and #1
  255.          beq t56
  256.  
  257.          ldx #6
  258. t50      lda xhalf+1,x
  259.          sec
  260.          sbc #12
  261.          cmp xhalf
  262.          bcs t55
  263.          adc #23
  264.          cmp xhalf
  265.          bcc t55
  266.          lda y+1,x
  267.          sec
  268.          sbc #21
  269.          cmp y
  270.          bcs t55
  271.          adc #41
  272.          cmp y
  273.          bcc t55
  274.          lda col+1,x
  275.          sta t60+1
  276. t55      dex
  277.          bpl t50
  278. t56
  279.          lda #52
  280. t59      cmp $d012
  281.          bcs t59
  282. t60      lda #0
  283.          sta $d020
  284.  
  285.          jmp $ea81
  286.  
  287. joyst    .byte 0
  288. xpoint   .byte 16
  289. ypoint   .byte 16
  290. speedtab .byte 252,253,254,255,0
  291.          .byte 1,2,3,4
  292. mal2     .byte 0,2,4,6,8,10,12,14
  293. x        .byte 160,140,40,200
  294.          .byte 110,40,170,70
  295. y        .byte 140,50,80,100
  296.          .byte 110,150,180,220
  297. col      .byte 7,10,6,3,5,8,4,13
  298. xhi      .byte 0,0,0,0,0,1,0,0
  299. xhalf    .byte 0,0,0,0,0,0,0,0
  300. oder     .byte 1,2,4,8,16,32,64,128
  301.  
  302.